<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/common/taglibs.jsp"%>
<html>
	<head>
		<base href="<%=basePath%>">
		<title>编辑用户</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<script type="text/javascript" >
			
		   var result = "${result}";
  		   if(result=='1'){
  		 	  alert("保存成功！");
  		      document.location.href ='${ctx}/pages/user/list.action';
  		   }
  		   
  		   function subForm(){
		   		var userName = $("#userName").val();
		   		var realName = $("#realName").val();
		   		if(checkIsNull(realName)){
		   			alert("真是名称不能为空");
		   			$("#realName").focus();
		   			return false;
		   		}
		   		$("#userForm").submit();
		   }
		   
				
		</script>
	</head>
	<body>
	<div id="body-wrapper">
		<div id="main-content">
			<div class="content-box">
				<!-- Start Content Box -->
				<div class="content-box-header">
					<h3 style="cursor: s-resize;">
						添加用户
					</h3>
					<div class="clear"></div>
				</div>
				<!-- End .content-box-header -->
				<div style="display: block;" class="content-box-content">
					<form method="post" id="userForm" name="userForm" action="${ctx }/pages/user/update.action"
						>
						<fieldset>
							<!-- Set class to "column-left" or "column-right" on fieldsets to divide the form into columns -->
							<p>
								<label>
									用户名 <input type="hidden" name="user.id" value="${user.id}" />
								</label>
								${user.userName}
							<p>
								<label>
									密码
								</label>
								<input  class="text-input small-input"
									name="user.loginPwd" id="password" type="password"><br/>(为空时不修改原密码)
							</p>
							
							<p>
								<label>
									真实姓名
								</label>
								<input  class="text-input small-input"
									name="user.realName" id="realName" value="${user.realName }" type="text">
							</p>
							<p>
								<label>
									手机号
								</label>
								<input  class="text-input small-input"
									name="user.phone" id="realName" value="${user.phone }" type="text">
							</p>							
							<p>
								<label>
									状态
								</label>
								<select class="small-input" name="user.status">
									<option value="1">
										启用
									</option>
									<option value="0" <c:if test="${user.status==0}"> selected="selected" </c:if> >
										锁定
									</option>
								</select>
							</p>
							<p>
								<label>
									备注
								</label>
								<textarea class="text-input textarea " id="textarea"
									name="user.remark" rows="8">${user.remark }</textarea>
							</p>
							
							<p>
								<label>
									用户角色
								</label>
								
								<c:forEach items="${roleList}" var="role">
									<input type="checkbox" <c:if test="${fn:containsIgnoreCase(userRoles, role.id)}"> checked="checked" </c:if > value="${role.id}" name="userRoleCB">${role.name} &nbsp;&nbsp;&nbsp;&nbsp;
								</c:forEach>

							</p>

							<p>
								<input class="button" value="提交" onclick="subForm();"  type="button">
								<input class="button" value="返回" onclick="history.back();"  type="button">
							</p>
						</fieldset>
						<div class="clear"></div>
						<!-- End .clear -->
					</form>
				</div>
			</div>
		</div>
		</div>
	</body>
</html>
